<?php defined('SYSPATH') or die('No direct script access.');
		
	class Model_Services_Average extends Model implements Jqgrid_GridListener{

		
		public function __construct(){
	
		}
		
		public function count($criteria = false){
			return ORM::factory("dao_average")->count_all();
		}
			
		public function getList($criteria = false){
			
			if (!$criteria)	$average_list = ORM::factory("dao_average")->find_all()->as_array();
			else $average_list = ORM::factory("dao_average")->order_by($criteria->sidx,$criteria->sord)->limit($criteria->limit)->find_all()->as_array();
		
			$dataset = array();
			foreach ($average_list as $average){
				$dataset[$average->id] = array($average->average,$average->description);
			}
			
			return $dataset;
		}
	
	
		public function getAll(){
			return ORM::factory("dao_average")->find_all()->as_array();
		}		
		
		
		public function save($id, array $data){
			
		}
		public function delete($id){
			
		}
		
	}
	
	
?>
